package com.feiyu.blog.feign;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.feiyu.blog.entity.Blog;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author tang ming
 * @since 2021/12/3 12:08
 */
@FeignClient(
        name = "blog-service",
        path = "/blog"
)
public interface BlogFeignClient {

    @GetMapping("/detail/{id}")
    R<Blog> detail(@PathVariable("id")int id);

    @GetMapping("/list")
    R<IPage<Blog>> page(Page<Blog> page);

    @PostMapping("/save")
    R save(@RequestBody Blog blog);

    @PostMapping("/update")
    R update(@RequestBody Blog blog);

    @PostMapping("/delete/{id}")
    R delete(@PathVariable("id") int id);
}
